package com.hsgene.order.persistence;

import com.hsgene.order.domain.v1.GeneticInvoice;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description:
 * @projectName: hdas-geneshop-server
 * @package: com.hsgene.order.persistence
 * @author: maodi
 * @createDate: 2018/10/11 15:10
 * @version: 1.0
 * Copyright: Copyright (c) 2018
 */
@Repository
public interface GeneticInvoiceRepository {

    /**
     * @param personName 个人名称
     * @param userId     用户id
     * @param id         当前发票id
     * @return int
     * @description 根据个人名称和用户id查找数量
     * @author maodi
     * @createDate 2018/10/11 17:23
     */
    int getCountByPersonNameAndUserId(@Param("personName") String personName, @Param("userId") String userId, @Param
            ("id") String id);

    /**
     * @param companyName 单位名称
     * @param userId      用户id
     * @param id          当前发票id
     * @return int
     * @description 根据单位名称和用户id查找数量
     * @author maodi
     * @createDate 2018/10/11 17:23
     */
    int getCountByCompanyNameAndUserId(@Param("companyName") String companyName, @Param("userId") String userId,
                                       @Param("id") String id);

    /**
     * @param userId 用户id
     * @return java.util.List<com.hsgene.order.domain.v1.GeneticInvoice>
     * @description 根据用户id获取发票列表
     * @author maodi
     * @createDate 2018/10/11 15:14
     */
    List<GeneticInvoice> getGeneticInvoiceByUserId(@Param("userId") String userId);

    /**
     * @param userId 用户id
     * @param id     发票id
     * @return com.hsgene.order.domain.v1.GeneticInvoice
     * @description 根据id获取发票
     * @author maodi
     * @createDate 2018/10/16 16:36
     */
    GeneticInvoice getGeneticInvoiceById(@Param("userId") String userId, @Param("id") String id);

    /**
     * @param geneticInvoice 发票信息实体
     * @return void
     * @description 新增发票信息
     * @author maodi
     * @createDate 2018/10/11 15:14
     */
    void insertGeneticInvoice(GeneticInvoice geneticInvoice);

    /**
     * @param id 发票id
     * @return void
     * @description 修改当前id的发票为默认
     * @author maodi
     * @createDate 2018/10/12 9:28
     */
    void updateGeneticInvoiceToDefault(@Param("id") String id);

    /**
     * @param id     当前发票id
     * @param userId 当前用户id
     * @return void
     * @description 修改除当前id外的发票为未默认
     * @author maodi
     * @createDate 2018/10/12 9:14
     */
    void updateOtherGeneticInvoiceToNotDefault(@Param("id") String id, @Param("userId") String userId);

    /**
     * @param geneticInvoice 发票信息实体
     * @return void
     * @description 修改发票信息
     * @author maodi
     * @createDate 2018/10/11 15:14
     */
    void updateGeneticInvoice(GeneticInvoice geneticInvoice);

    /**
     * @param id 发票id
     * @return void
     * @description 根据发票id删除发票信息
     * @author maodi
     * @createDate 2018/10/11 15:14
     */
    void deleteGeneticInvoiceById(@Param("id") String id);

    /**
     * @param id 发票id
     * @return void
     * @description 将发票改为企业发票
     * @author maodi
     * @createDate 2018/12/11 16:10
     */
    void updateToCompanyInvoice(@Param("id") String id);

    /**
     * @param id 发票id
     * @return
     * @description 将发票改为个人发票
     * @author maodi
     * @createDate 2018/12/11 16:11
     */
    void updateToPersonInvoice(@Param("id") String id);
}
